/*
 *   message routines
 */

#include <stdio.h>
#include <stdlib.h>

#define VARARG fmt, v1, v2, v3, v4, v5

#define VARPARAM (VARARG) char * fmt;

extern int yylineno;

extern FILE * yyerfp;

extern int yynerrs;

void message VARPARAM
{
  fprintf( yyerfp, "line %d : ", yylineno);
  fprintf( yyerfp, VARARG);
  putc('\n', yyerfp);
} /* message */

void error VARPARAM
{
  extern int yynerrs;

  fprintf( yyerfp, "[error %d]    ", ++ yynerrs);
  message(VARARG);
} /* error */

void warning VARPARAM
{
  fputs("[warning]    ", yyerfp);
  message(VARARG);
} /* warning */

void fatal VARPARAM
{
  fputs("[fatal error] ", yyerfp);
  message(VARARG);
  exit(1);
} /* warning */

void bug VARPARAM
{
  fputs("BUG: ", yyerfp);
  message(VARARG);
  exit(1);
} /* bug */
